﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace TmU220PrintHelperV2d0.Entity
{
    /// <summary>
    /// 打印任务主表
    /// </summary>
    [Serializable]
    public class rms_order_print_main
    {
        public int id { get; set; }
        public string uid { get; set; }
        public DateTime? addtime { get; set; }
        /// <summary>
        /// 工作站ID,对应station
        /// </summary>
        public int? station_id { get; set; }
        /// <summary>
        /// 设置用于打印的打印机
        /// </summary>
        public string printer { get; set; }
        public string place { get; set; }
        /// <summary>
        /// 手机用于打印的打印机
        /// </summary>
        public string act_printer { get; set; }
        /// <summary>
        /// 状态 0未打印(等待打印) 1完成打印,2,打印失败
        /// </summary>
        public int? status { get; set;}
        public DateTime? printtime { get; set; }
        public DateTime? void_time { get; set; }
        public string void_reason { get; set; }
        /// <summary>
        /// 是否转向打印
        /// </summary>
        public bool? is_transfer { get; set; }
        /// <summary>
        /// 台号/叫号
        /// </summary>
        public string tableno { get; set; }
        /// <summary>
        /// 餐台名称
        /// </summary>
        public string tablename { get; set; }
        /// <summary>
        /// 是否叫起
        /// </summary>
        public bool? is_hold { get; set; }
        /// <summary>
        /// 是否即起
        /// </summary>
        public bool? is_call { get; set; }
        /// <summary>
        /// 是否取消
        /// </summary>
        public bool? is_void { get; set; }
        public string adduser { get; set; }
        /// <summary>
        /// 是否转台
        /// </summary>
        public bool? is_move { get; set; }
        public string move_from { get; set; }
        public string move_to { get; set; }
        /// <summary>
        /// 打印编号
        /// </summary>
        public int? print_no { get; set; }
        public string outlet_info { get; set; }
        public bool? is_remind { get; set; }
        public int? remind_times { get; set; }
        public string remind_passtime { get; set; }
        public string remind_reason { get; set; }
        public List<rms_order_print_detail> detailList { get; set; }
        public rms_order_print_main()
        {
            id = 0;
            uid = string.Empty;
            addtime = DateTime.Now;
            station_id = 0;
            printer = string.Empty;
            act_printer = string.Empty;
            status = 0;
            printtime = DateTime.Now;
            is_transfer = false;
            tableno = string.Empty;
            tablename = string.Empty;
            is_hold = false;
            is_call = false;
            is_void = false;
            adduser = string.Empty;
            print_no = null;
            detailList = new List<rms_order_print_detail>();
        }
    }
    /// <summary>
    /// 打印任务明细表
    /// </summary>
    [Serializable]
    public class rms_order_print_detail
    {
        /// <summary>
        /// 对应rms_order_print_main的uid
        /// </summary>
        public string parent_id { get; set; }
        /// <summary>
        ///数量
        /// </summary>
        public double? qty { get; set; }
        /// <summary>
        /// 规格
        /// </summary>
        public string spec { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string descdisp { get; set; }
        /// <summary>
        /// 对应rms_item表的uid
        /// </summary>
        public int? item_id { get; set; }
        public bool? is_modifier { get; set; }
        /// <summary>
        /// 对应rms_modifier表的uid
        /// </summary>
        public int? modi_id { get; set; }
        public bool? is_void { get; set; }
        /// <summary>
        /// 显示次序
        /// </summary>
        public int dispord { get; set; }
        public rms_order_print_detail()
        {
            parent_id = string.Empty;
            qty = 0;
            spec = string.Empty;
            descdisp = string.Empty;
            item_id = 0;
            is_modifier = false;
            modi_id = 0;
            is_void = false;
            dispord = 0;
        }
    }
    [Serializable]
    public class rms_printer
    {
        [XmlElement("ShopId")]
        public int shop_id { get; set; }
        [XmlElement("打印机id")]
        public int id { get; set; }
        [XmlElement("打印机Uid")]
        public int uid { get; set; }
        [XmlElement("打印机name1")]
        public string name1 { get; set; }
        [XmlElement("打印机name2")]
        public string name2 { get; set; }
        [XmlElement("打印机name3")]
        public string name3 { get; set; }
        [XmlElement("打印机名称")]
        public string printername { get; set; }
        /// <summary>
        /// 打印机ip地址
        /// </summary>
        [XmlElement("打印机IP")]
        public string ip { get; set; }
        /// <summary>
        /// 打印机端口
        /// </summary>
        [XmlElement(ElementName="打印机Port",IsNullable =true)]
        public int? port { get; set; }
        /// <summary>
        /// 备份打印机
        /// </summary>
        [XmlElement("备份打印机名称")]
        public string backup_printer { get; set; }
        /// <summary>
        /// 是否生效
        /// </summary>
        [XmlElement(ElementName = "打印机是否生效",IsNullable =true)]
        public bool? is_active { get; set; }
        [XmlElement("打印机createby")]
        public string createby { get; set; }
        [XmlElement(ElementName = "打印机createtime", IsNullable = true)]
        public DateTime? createtime { get; set; }
        [XmlElement("打印机editby")]
        public string editby { get; set; }
        [XmlElement(ElementName = "打印机edittime",IsNullable = true)]
        public DateTime? edittime { get; set; }
        /// <summary>
        /// 刪除者,如不為NULL表示已被標記刪除
        /// </summary>
        [XmlElement("打印机voidby")]
        public string voidby { get; set; }
        /// <summary>
        /// 删除时间
        /// </summary>
        [XmlElement(ElementName = "打印机voidtime", IsNullable = true)]
        public DateTime? voidtime { get; set; }
        /// <summary>
        /// 打印机字库汉字编码
        /// </summary>
        [XmlElement("打印机字库编码")]
        public string print_font { get; set; }
        /// <summary>
        /// 打印机汉字字库是否繁体
        /// </summary>
        [XmlElement(ElementName = "打印机是否繁体",  IsNullable = true)]
        public bool? is_traditional { get; set; }
        /// <summary>
        /// 状态 null:状态位置 0：正常 99：异常
        /// </summary>
        [XmlElement(ElementName = "打印机状态", IsNullable = true)]
        public int? status { get; set; }
        /// <summary>
        /// 最后状态更新时间
        /// </summary>
        [XmlElement(ElementName = "状态更新时间", IsNullable = true)]
        public DateTime? lastupdatetime { get; set; }
        [XmlElement("设备类型")]
        public string device_type { get; set; }

        public rms_printer()
        {
            id = 0;
            uid = 0;
            name1 = string.Empty;
            name2 = string.Empty;
            name3 = string.Empty;
            printername = string.Empty;
            ip = "192.168.1.99";
            port = 9100;
            backup_printer = string.Empty;
            is_active = false;
            createby = string.Empty;
            createtime = DateTime.Now;
            editby = string.Empty;
            edittime = DateTime.Now;
            voidby = string.Empty;
            voidtime = DateTime.Now;
            print_font = "Big5";//GB18030 Big5
            is_traditional = true;
            status = null;
            lastupdatetime = DateTime.Now;
            device_type = "TM-U220";
        }
    }
    [Serializable]
    public class rms_order_print_log
    {
        public int id { get; set; }
        public int uid { get; set; }
        public string task_uid { get; set; }
        public DateTime addtime { get; set; }
        /// <summary>
        /// 实际用于打印的打印机
        /// </summary>
        public string act_printer { get; set; }
        /// <summary>
        /// 状态 0未打印(等待打印) 1完成打印,2,打印失败
        /// </summary>
        public int? status { get; set; }
        public DateTime? printtime { get; set; }
        //public DateTime? loadtime { get; set; }
               /// <summary>
        /// 台号/叫号
        /// </summary>
        public string tableno { get; set; }
        /// <summary>
        /// 打印编号
        /// </summary>
        public string print_no { get; set; }
        public string print_content { get; set; }
        public string process_description { get; set; }
        public DateTime? edittime { get; set; }
        public rms_order_print_log()
        {
            uid = 0;
            task_uid = string.Empty;
            addtime = DateTime.Now;
            act_printer = string.Empty;
            status = 99;
            printtime = DateTime.Now;
            tableno = string.Empty;
            print_no = string.Empty;
            print_content = string.Empty;
            process_description = string.Empty;
        }
        public rms_order_print_log(PrintLogV3d0 printLog)
        {
            uid = 0;
            task_uid = printLog.uid;
            addtime = printLog.addtime;
            //loadtime = printLog.loadtime;
            act_printer = printLog.act_printer;
            status = printLog.status;
            printtime = printLog.printtime;
            tableno = printLog.tableno;
            print_no = printLog.print_no;
            print_content = string.Join(",", printLog.DetailList);
            process_description = string.Join(",", printLog.PrintProcessDescriptionList);
        }
    }
    [Serializable]
    public class rms_print_templet_main
    {
        public int id { get; set; }
        public int uid { get; set; }
        public string templet_guid { get; set; }
        public string templet_name { get; set; }
        public string templet_type { get; set; }
        public string templet_language { get; set; }
        public bool is_active { get; set; }
        public DateTime? edittime { get; set; }
        public rms_print_templet_main()
        {
            id = 0;
            uid = 0;
            templet_guid = "";
            templet_name = "";
            templet_type = "";
            templet_language = "";
            is_active = true;
            edittime = DateTime.Now;
        }
        public rms_print_templet_main(string templetGuid,string templetName,string templetType,string language="zh")
        {
            id = 0;
            uid = 0;
            templet_guid = templetGuid;
            templet_name = templetName;
            templet_type = templetType;
            templet_language = language;
            is_active = true;
            edittime = DateTime.Now;
        }
        public rms_print_templet_main(int templetUid,string templetGuid, string templetName, string templetType, string language = "zh")
        {
            id = 0;
            uid = templetUid;
            templet_guid = templetGuid;
            templet_name = templetName;
            templet_type = templetType;
            templet_language = language;
            is_active = true;
            edittime = DateTime.Now;
        }
    }
    [Serializable]
    public class rms_print_templet_detail
    {
        public int id { get; set; }
        public int? uid { get; set; }
        public int parent_id { get; set; }
        public string templet_guid { get; set; }
        public int row_index { get; set; }
        public string row_guid { get; set; }
        public string print_mode { get; set; }
        public string area_type { get; set; }
        public int element_index { get; set; }
        public string content_text { get; set; }
        public string vertical_align { get; set; }
        public string horizontal_align { get; set; }
        public string font_name { get; set; }
        public string font_color { get; set; }
        public int font_size { get; set; }
        public bool? is_double_width { get; set; }
        public bool? is_double_height { get; set; }
        public bool? is_underline { get; set; }
        public bool? is_bold { get; set; }
        public bool? is_cutoffline { get; set; }
        public DateTime? edittime { get; set; }
    }

}
